View Javadoc
1 package jrre.gui; 2 3 import java.awt.*; 4 import javax.swing.*; 5 6 7 public class Script extends JPanel{ 8 private int height,width; 9 10 public JTextArea script; 11 public JScrollPane sc; 12 13 public Script(int width,int height){ 14 super(new BorderLayout()); 15 this.width = width;this.height = height; 16 script = new JTextArea(width,height); 17 script.setFont(new Font(null,Font.BOLD,16)); 18 script.setBackground(Color.lightGray); 19 script.setEditable(false); 20 sc = new JScrollPane(script,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); 21 sc.setPreferredSize(new Dimension(width,height)); 22 setSize(width,height); 23 setVisible(true); 24 setBackground(Color.black); 25 setMinimumSize(new Dimension(width,height)); 26 setMaximumSize(new Dimension(width,height)); 27 setPreferredSize(new Dimension(width,height)); 28 setBorder(new javax.swing.border.EtchedBorder(javax.swing.border.EtchedBorder.RAISED, java.awt.Color.black, java.awt.Color.gray)); 29 add(sc,"Center"); 30 updateUI(); 31 } 32 33 public void appendMessage(String s){ 34 script.append(s + "\n"); 35 } 36 37 protected void paintComponent(Graphics g){ 38 super.paintComponent(g); 39 } 40 }

This page was automatically generated by Maven